public class SealedAnimal {
    private   int legs;

    public void eat() {
        System.out.println("正在吃东西");
    }

    public void move() {
        System.out.println("正在跑步");
    }

    public int getLegs() {
        return legs;
    }

    public void setLegs(int legs) {
        if ((legs == 0) || (legs == 2) || (legs == 4)) {
            this.legs = legs;
        }
        else {
            System.out.println("您设置的 legs 属性不合理");
        }
    }
}

